
package card;

import java.sql.*;

/**
 *
 * @author DA5221-GRP63
 */

public class staticMessage {
public staticMessage(String id)
  {
    this.CardID=id;
    try
  {
            con = cardConnect.getconn();
            query = con.createStatement();
            queryString1 = "SELECT EventMoney FROM card WHERE CardID='" + Integer.parseInt(CardID)+"'";
            rs1 = query.executeQuery(queryString1); //get the result
            if (rs1.next()) {
                System.out.println("current amount" + rs1.getString(1));
                yue = rs1.getString(1);
                exist = true;
            }
            queryString2 = "Select userName From card Where CardID='" + Integer.parseInt(CardID)+"'";
            rs2 = query.executeQuery(queryString2);
            if (rs2.next()){
                userName=rs2.getString(1);
                System.out.println(userName);
                exist = true;
            }

        } catch (Exception ee) {
        } finally {
            cardConnect.close(rs1);
            cardConnect.close(rs2);
            cardConnect.close(query);
            cardConnect.close(con);
        }
    }

    public boolean isExist()
  {
    return exist;
  }
  public static String getUserName()
  {
      System.out.println(userName);
    return userName;
  }
  public static String getLevel()
  {
    return yue;
  }

 

  String queryString1;
  String queryString2;
  Connection con;
  Statement query;
  ResultSet rs1;
  ResultSet rs2;
  static String CardID;
  public static String userName;
  public static String yue;
  static boolean exist=false;
}

